Skip to content

feat: add db.collection.getIndexes() operation support#8

Merged
d-bytebase merged 1 commit intomainfrom
vk/bd54-gomongo-mileston
Jan 19, 2026
Merged

feat: add db.collection.getIndexes() operation support#8
d-bytebase merged 1 commit intomainfrom
vk/bd54-gomongo-mileston

Conversation

@h3n4l
Copy link
Member

@h3n4l h3n4l commented Jan 19, 2026

Summary

  • Add support for db.collection.getIndexes() command
  • Returns index information including name, key, and options
  • Works with all collection access methods (dot notation, bracket notation, getCollection)

Test plan

  • Integration test for basic getIndexes (default _id index)
  • Integration test with custom index
  • Integration test with bracket notation for hyphenated collection names
  • All existing tests pass
  • Linting clean

Generated with Claude Code

Add support for the db.collection.getIndexes() command which returns
index information for a collection including name, key, and options.

Syntax:
- db.users.getIndexes()
- db["user-logs"].getIndexes()

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings January 19, 2026 07:07
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds support for the MongoDB db.collection.getIndexes() operation, which allows users to retrieve index information for a collection. The implementation follows the existing patterns in the codebase and includes comprehensive test coverage.

Changes:

  • Added opGetIndexes operation type and parsing support in the translator
  • Implemented executeGetIndexes() function to list indexes using the MongoDB driver
  • Refactored method parsing from if-else chain to switch statement for better maintainability
  • Added three integration tests covering basic usage, custom indexes, and bracket notation

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

File Description
translator.go Added opGetIndexes constant and refactored method call parsing to use switch statement; added case for "getIndexes" method
executor.go Added executeGetIndexes() function that lists indexes for a collection and formats them as Extended JSON
executor_test.go Added three test cases: basic getIndexes test, custom index test, and bracket notation test

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@d-bytebase d-bytebase merged commit 4c64b43 into main Jan 19, 2026
8 checks passed
@d-bytebase d-bytebase deleted the vk/bd54-gomongo-mileston branch January 19, 2026 07:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants